package com.token.iot.bratterycharging.gateway.oper;

import org.springframework.stereotype.Component;

import com.outstanding.framework.core.Logger;
import com.outstanding.framework.core.PendingException;
import com.outstanding.framework.log.LoggerFactory;
import com.token.iot.bratterycharging.gateway.AbstractOper;
import com.token.iot.bratterycharging.gateway.IDGeneration;
import com.token.iot.bratterycharging.gateway.IMEI;
import com.token.iot.bratterycharging.gateway.Oper;
import com.token.iot.bratterycharging.gateway.SemaphoreManager;

import io.netty.channel.ChannelHandlerContext;

/**
 * 获取设备类型
 * @author chenzhixuan
 *
 */
@Component("ASYOper")
public class ASYOper extends AbstractOper {
	
	
	
	private static Logger loger = LoggerFactory.getLogger(ASYOper.class);
	
	
	@Override
	public int onCall(byte[] b,ChannelHandlerContext ctx) throws PendingException {
		String val = new String(b);
		String imei = IMEI.getIMEI(ctx);
		//ASY 实际返回的sessionID = A00003
		String sessionid = "000000";
		String key = imei+"@"+sessionid;
		SemaphoreManager.onResponse(key, val);
		return 0;
	}


}
